<?php
/**
 * 
 * IndexAction.class.php (前台首页)
 *
 * @package      	jgsat
 * @author          liuxun QQ:147613338 <admin@jgsat.cn>
 * @copyright     	Copyright (c) 2008-2011  (http://www.jgsat.com)
 * @license         http://www.jgsat.com/license.txt
 * @version        	jgsat企业网站管理系统 v2.1 2011-03-01 jgsat.cn $
 */
if(!defined("JGsat")) exit("Access Denied");
class TopicAction extends BaseAction
{
    function _initialize()
    {	
        parent::_initialize();
        if(!$this->_userid){
            $this->assign('jumpUrl',U('User/Login/index'));
            $this->error(L('nologin'));
            exit;
        }
        $this->assign('bcid',0);
        $user = M('User')->find($this->_userid);
        $this->assign('vo',$user);
        unset($_POST['status']);
        unset($_POST['groupid']);
        unset($_POST['amount']);
        unset($_POST['point']);
        $_GET =get_safe_replace($_GET);
        $count1 = M('Order')->where("userid=".$this->_userid)->count();
        $count2 = M('Order')->where("userid=".$this->_userid." and status<>0 and pay_status<>0 and shipping_status<>0")->count();
        $count3 = M('Order')->where("userid=".$this->_userid." and status=0 and pay_status=0 and shipping_status=0")->count();
        $count4 = M('Order')->where("userid=".$this->_userid." and status=4")->count();
        $this->assign('count1',$count1);  
        $this->assign('count2',$count2);  
        $this->assign('count3',$count3);  
        $this->assign('count4',$count4);
        $messagecount = M("User_message")->where("touserid=".$this->_userid." or touserid=0")->count();
        $this->assign('messagecount',$messagecount);
        if($this->_groupid==7){
            $sjcount1 = M('Order')->where("sjuserid=".$this->_userid)->count();
            $sjcount2 = M('Order')->where("sjuserid=".$this->_userid." and status=2")->count();
            $sjcount3 = M('Order')->where("sjuserid=".$this->_userid." and status<2 and (pay_status=2 or pay_status=3) and (shipping_status=0 or shipping_status=3)")->count();
            $sjcount4 = M('Order')->where("sjuserid=".$this->_userid." and status=5")->count();
            $sjcount5 = M('Order')->where("sjuserid=".$this->_userid." and status<2 and pay_status=3 and shipping_status=3")->count();
            $this->assign('sjcount1',$sjcount1);  
            $this->assign('sjcount2',$sjcount2);  
            $this->assign('sjcount3',$sjcount3);  
            $this->assign('sjcount4',$sjcount4);
            $this->assign('sjcount5',$sjcount5);
        }
    }
    public function blog()
    {
        $this->dao = M('Topic');
        $count = $this->dao->where("userid=".$this->_userid)->count();
        if($count){
            import ( "@.ORG.Page" );
            $listRows =  15;
            $page = new Page ( $count, $listRows );
            $pages = $page->show();
            $field =  $this->module[$this->mod[$module]]['listfields'];
            $field =  "*";
            $list = $this->dao->field($field)->where("userid=".$this->_userid)->order("id desc")->limit($page->firstRow . ',' . $page->listRows)->select();
            $this->assign('pages',$pages);
            $this->assign('list',$list);
        }
        $this->assign('menuWZ',23);
        $this->display();
    }
    public function jgreplay()
    {
        $this->dao = M('Comment');
        $count = $this->dao->where("userid=".$this->_userid)->count();
        if($count){
            import ( "@.ORG.Page" );
            $listRows =  10;
            $page = new Page ( $count, $listRows );
            $pages = $page->show();
            $field =  $this->module[$this->mod[$module]]['listfields'];
            $field =  "*";
            $list = $this->dao->field($field)->where("userid=".$this->_userid)->order("id desc")->limit($page->firstRow . ',' . $page->listRows)->select();
            $this->assign('pages',$pages);
            $this->assign('list',$list);
        }
        $this->assign('menuWZ',24);
        $this->display();
    }
   
}
?>